Skip to content

MENDELU/fix: unvalid openaire4 OAI-PMH endpoint#1286

Merged
milanmajchrak merged 1 commit intocustomer/mendelufrom
mendelu-fix-openaire4
Mar 19, 2026
Merged

MENDELU/fix: unvalid openaire4 OAI-PMH endpoint#1286
milanmajchrak merged 1 commit intocustomer/mendelufrom
mendelu-fix-openaire4

Conversation

@milanmajchrak
Copy link
Collaborator

Problem description

DSpace 9.1 fails OAI-PMH validation at Open Archives (openarchives.org) with:

FAIL Bad responseDate of 2025-08-02T21:13:43.801369Z, the date is a UTC DateTime but includes decimal seconds which are not allowed by the specification, must be YYYY-MM-DDThh:mm:ssZ format.

Root cause: DateUtils.format(Instant) calls Instant.toString() which includes nanoseconds when they are non-zero. The OAI-PMH spec requires YYYY-MM-DDThh:mm:ssZ without fractional seconds.

Additionally, the openaire4 context in xoai.xml is missing the oai_dc metadata format, which is the only format required by the OAI-PMH spec for every endpoint.

Changes

  1. DateUtils.format(Instant) — truncate to seconds and format via DateTimeFormatter.ISO_INSTANT instead of Instant.toString() (port of DSpace#11438)
  2. DateUtilsTest — unit test verifying nanoseconds are stripped
  3. xoai.xml — add <Format ref="oaidc"/> to the openaire4 context

Analysis

(Write here, if there is needed describe some specific problem. Erase it, when it is not needed.)

Problems

(Write here, if some unexpected problems occur during solving issues. Erase it, when it is not needed.)

Manual Testing (if applicable)

Copilot review

  • Requested review from Copilot

…1438)  DateUtils.format(Instant) produced timestamps with fractional seconds (e.g. 2025-10-09T18:53:58.376565922Z) which violates the OAI-PMH spec requiring YYYY-MM-DDThh:mm:ssZ format, causing validation failures at Open Archives.  Also add oai_dc metadata format to the openaire4 context in xoai.xml, as oai_dc is required by the OAI-PMH specification for every endpoint.
Copilot AI review requested due to automatic review settings March 18, 2026 14:39
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes OAI-PMH compliance issues in the DSpace OAI provider by ensuring responseDate values match the required YYYY-MM-DDThh:mm:ssZ format (no fractional seconds) and by ensuring the openaire4 endpoint exposes the required oai_dc metadata format.

Changes:

  • Truncate Instant values to seconds before formatting OAI-PMH dates.
  • Add oaidc format to the openaire4 XOAI context.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
dspace-oai/src/main/java/org/dspace/xoai/util/DateUtils.java Ensures formatted OAI-PMH timestamps never include fractional seconds.
dspace/config/crosswalks/oai/xoai.xml Adds the required oai_dc metadata format to the openaire4 context.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines 37 to 40
public static String format(Instant date) {
// NOTE: OAI-PMH REQUIRES that all dates be expressed in UTC format
// as YYYY-MM-DDThh:mm:ssZ For more details, see
// http://www.openarchives.org/OAI/openarchivesprotocol.html#DatestampsResponses

// toString returns the correct format
return date.toString();
Instant truncated = date.truncatedTo(ChronoUnit.SECONDS);
return DateTimeFormatter.ISO_INSTANT.format(truncated);
}
@milanmajchrak milanmajchrak merged commit 7792639 into customer/mendelu Mar 19, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants